package test;

//import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
//import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
//import java.util.Scanner;

public class SaveFile {
	public void saveFile() {
		try {
			File f = new File("Database.txt");
			FileOutputStream fo = new FileOutputStream(f);
			BufferedOutputStream bo = new BufferedOutputStream(fo);
			PrintStream ps = new PrintStream(bo);
			String name, age, address;
			name = "Lis Channath";
			age = "22";
			address = "Phnom Penh";
			String st;
			st=name+";"+age+";"+address;
			ps.print(st);
			ps.close();
			bo.close();
			fo.close();
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	public void openFile() {
		try {
//			File f = new File("Database.txt");
//			FileInputStream fi = new FileInputStream(f);
//			BufferedInputStream bi = new BufferedInputStream(fi);
//			Scanner sc = new Scanner(bi);
//			String st;
//			st = sc.nextLine();
//			String d[];
//			d = st.split(";", 3);
//			String name, age, address;
//			name=d[0];
//			age=d[1];
//			address=d[2];
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
}
